import React from 'react'
import { Tabs,Tooltip,Button,Icon } from 'antd'

const TabPane = Tabs.TabPane;

class Header extends React.Component {
	constructor(props) {
		super(props)
		
		this.state = {
			
		}
	}
	
	callback = key =>{
		const params = {
			operatingState: key,
			operatingType: 1,
		}
		const {showMenu,onSearch} = this.props
		showMenu(key)
		onSearch(params)
	}
	componentDidMount(){
		const {onSearch,menu,pagination} = this.props
		const params = {
			operatingState: menu,
			operatingType: 1,
			page:pagination.current
		}
		onSearch(params)
	}
	goDetails = () => {
		const { goList } = this.props
		goList()
	}
	render(){
		const {menu} = this.props
		const keys = 1
		const permissions = JSON.parse(sessionStorage.getItem("permissions"))

		return(
			<div style={{position:"relative"}}>
				<Tabs defaultActiveKey={menu} onChange={this.callback}>
					{permissions.indexOf("file:fileChange:apply") != -1?
					<TabPane tab="变更申请" key="0">
			            
					</TabPane>
					:""}

					{permissions.indexOf("file:fileChange:apply") != -1? 
			         <TabPane tab="我提交的" key="2">
			           
			         </TabPane>
					 :""}
					 
					{permissions.indexOf("file:fileChange:checked") != -1?  
			         <TabPane tab="待审核" key="1">
			           
			         </TabPane>
			        :""} 

					{permissions.indexOf("file:fileChange:checked") != -1?  
			         <TabPane tab="已审核" key="3">
			           
			         </TabPane>
					:""}  
				</Tabs>
				<Tooltip placement="topLeft" title="可点此查看变更档案历史版本">
					<Button 
					 	style={{position:"absolute",top:0,right:0,border:"none"}}
						onClick={this.goDetails}
					>
					  <Icon type="right-circle-o" />
					  管理员审查
					</Button>
    			</Tooltip>
			</div>
		)
	}
}

export default Header